package com.info33.platform.system.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.info33.platform.common.enums.LoginType;
import com.info33.platform.common.mvc.entity.BaseEntity;
import com.info33.platform.system.dto.SysTenantUserDTO;
import com.info33.platform.system.util.enums.UserTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * 系统 - 租户用户
 *
 * @author admin
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SysTenantUser extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户 id【sys_user】")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    @ApiModelProperty(value = "用户类型：USER/普通用户、ADMIN/管理员")
    private UserTypeEnum userType;

    @ApiModelProperty(value = "最近登录时间")
    private Date loginTime;

    @ApiModelProperty(value = "登录方式")
    private LoginType loginType;

    @ApiModelProperty(value = "主题色")
    @NotBlank(groups = {SysTenantUserDTO.ChangeMainColor.class}, message = "主题色不能为空")
    private String mainColor;

    @ApiModelProperty(value = "是否已经被锁定")
    private Boolean locked;

}